package com.gs.synedocket.presenter;

import com.google.gson.reflect.TypeToken;
import com.gs.synedocket.apiresult.ApiResultData;
import com.gs.synedocket.db.dto.LogDto;
import com.gs.synedocket.db.entity.Docket;
import com.gs.synedocket.db.entity.DocketPhoto;
import com.gs.synedocket.model.LogModel;
import com.gs.synedocket.model.listener.OnResultListener;
import com.gs.synedocket.view.ILogService;
import com.gs.synedocket.view.ISyncUpload;

import java.util.List;

public class LogPresenter extends BasePresenter<ILogService> {
    private final LogModel logModel = new LogModel();


    public void upload(List<LogDto> bean,String ids) {
        if (getView() != null) {
            logModel.uploadLog(bean, new OnResultListener() {
                @Override
                public void onSuccess(Object aipResult) {
                    if (getView() != null) {
                        getView().onUploadLogSuccess((ApiResultData<String>) aipResult, ids);
                    }
                }

                @Override
                public void onFails(Exception e) {
                    if (getView() != null) {
                        getView().onUploadLogFails(e);
                    }
                }
            }, new TypeToken<ApiResultData<String>>() {
            }.getType());
        }
    }

}
